<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div>
        <ul>
            <li>
                <a href="#/findMusic">发现音乐</a>
            </li>
            <li>
                <a href="#/myMusic">我的音乐</a>
            </li>
            <li>
                <a href="#/friend">关注</a>
            </li>
        </ul>
        <div class="find-music">发现音乐的页面</div>
        <div class="my-music">我的音乐页面</div>
        <div class="friend">关注页面</div>
    </div>
    <script>
        var findMusic = document.querySelector(".find-music")
        var myMusic = document.querySelector(".my-music")
        var friend = document.querySelector(".friend")

        window.addEventListener("hashchange", ()=>{
            if(window.location.hash === "#/findMusic") {
                findMusic.style.display = "block"
                myMusic.style.display = "none"
                friend.style.display = "none"
            }else if(window.location.hash === "#/myMusic") {
                findMusic.style.display = "none"
                myMusic.style.display = "block"
                friend.style.display = "none"
            }else if(window.location.hash === "#/friend") {
                findMusic.style.display = "none"
                myMusic.style.display = "none"
                friend.style.display = "block"
            }
        })
    </script>
</body>
</html>